<?php
/**
 * Base class that require for multi action per controller
 *
 * @package     nuo
 * @subpackage  nuo.controller
 * @author      Nam Nguyen <nam.ngvan@gmail.com>
 * @version     1.0
 * @since       Apr 19, 2013
 */
class Nuo_Controller_Resolver extends Nuo_Controller
{
	/**
	 * action value string
	 * @access protected
	 * @var    string
	 */
	protected $_act = 'act';

	/**
	 * default action value string
	 * @access protected
	 * @var    string
	 */
	protected $_defaultAct= 'act';

	/**
	 * default action
	 * @param  Nuo_Request  $request
	 * @return string
	 */
	function doAct($request)
	{
		return '';
	}
	
	/**
	 * default action
	 * @param  Nuo_Request  $request
	 * @return string
	 */
	function execute($request)
	{
		$act = $request -> getParam($this -> _act);

		$method = 'do' . inflect($act);

		if (!method_exists($this, $method))
		{
			$method = 'do' . inflect($this -> _defaultAct);
		}

		$this -> {$method}($request);
	}

}
